package com.zwz.preProcessArea;

import java.util.regex.Pattern;

public class Validator {

    // 验证手机号 (13/14/15/16/17/18/19开头)
    public static boolean isValidChineseMobile(String mobile) {
        String regex = "^1[3-9]\\d{9}$";
        return Pattern.matches(regex, mobile);
    }

    // 验证固定电话（带区号）
    public static boolean isValidChineseLandline(String landline) {
        String regex = "^0\\d{2,3}-?[1-9]\\d{6,7}$";
        return Pattern.matches(regex, landline);
    }

    // 综合验证（手机号或固话）
    public static boolean isValidChinesePhone(String phone) {
        return isValidChineseMobile(phone) || isValidChineseLandline(phone);
    }

    // 邮箱验证
    public static boolean isValidEmail(String email) {
        String regex = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}$";
        return Pattern.matches(regex, email);
    }



}